package com.sumer.psychology.common.domain.model;

import org.apache.commons.lang3.StringUtils;

/**
 * 修改密码
 * <p/>
 * Created by twer on 15/4/17.
 */
public class ChangePasswordCommand {
    private String userId;
    private String oldPassword;
    private String newPassword;

    public ChangePasswordCommand(String userId, String oldPassword, String newPassword) {
        this.userId = userId;
        this.oldPassword = oldPassword;
        this.newPassword = newPassword;
    }

    public String userId() {
        return userId;
    }

    public String toParameters() {
        String parameters = "";
        if (StringUtils.isNotBlank(oldPassword)) {
            parameters += "&oldPass=" + oldPassword;
        }
        if (StringUtils.isNotBlank(newPassword)) {
            parameters += "&newPass=" + newPassword;
        }
        return parameters;
    }
}
